
ul.Log = function(){};

ul.Log.ExpandController = function ( element )
{
	this.element = element;
	this.render();
};
ul.Log.ExpandController.prototype = {
	
	render:function()
	{
		var expand = this.createLink ( "Expand", expandAll );
		var collapse = this.createLink ( "collapse", collapseAll );
		var input = this.createCheckbox( "exceptDetails", false, setExceptDetails );
		var label = this.createLabel( "exceptDetails", "except details" );
		
		this.element.appendChild( expand );
		this.element.appendChild( document.createTextNode ( " or " ) );
		this.element.appendChild( collapse );
		this.element.appendChild( document.createTextNode ( " all " ) )
		this.element.appendChild( input );
		this.element.appendChild( label );		
	},
	createLink:function( name, fn )
	{
		var a = document.createElement ( "a" );
		a.href = "#";
		a.onclick = function () { fn (); }
		a.appendChild( document.createTextNode ( name ) );
		
		return a;
	},
	createCheckbox:function( id, init, callback )
	{
		var input = document.createElement ( "input" );
		input.type = "checkbox";
		input.checked = init;
		input.id = id;
		input.onclick = function () { callback( input.checked ); };
		
		return input;
	},
	createLabel:function( htmlFor, content )
	{
		var label = document.createElement ( "label" );
		label.htmlFor = htmlFor;		
		label.appendChild( document.createTextNode ( content ) );
		
		return label;
	}
};
